﻿<!DOCTYPE html>
<!--日常评估考核管理编辑-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <style>

        body {
            padding-bottom: 10px;
        }
    </style>
</head>
<body>
    <div id="app" v-cloak class="popupW100">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" label-width="180px" size="mini" label-position="right">
            <el-row>
                <el-col :span="10">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.ContractorName" autocomplete="off" size="mini" :disabled="true">
                                <template slot="prepend">
                                    {{DailyAssessment.ContractorName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="1">
                    <el-button type="primary" @click="ContractorInput('tj')">{{col.Choose}}</el-button>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{DailyAssessment.DailyAssessmentTypeName+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.DailyAssessmentTypeName" slot="suffix" :placeholder="DailyAssessment.DailyAssessmentTypeName" @change="aa">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in DailyAssessmentTypeName" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.ProjectName" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{DailyAssessment.ProjectName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :span="11" :offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    <div> {{DailyAssessment.TerritorialAppraiser+mark.m}}</div>
                                </template>
                                <el-select @visible-change="visibleChange" v-model="Form.TerritorialAppraiser" slot="suffix" :placeholder="DailyAssessment.TerritorialAppraiser">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in reviewPeople" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-form-item :label="DailyAssessment.TerritorialEvaluationConclusion+mark.m" prop="TerritorialEvaluationConclusion">
                    <el-input type="textarea" v-model="Form.TerritorialEvaluationConclusion" autocomplete="off"></el-input>
                </el-form-item>
            </el-row>
            <el-row>

                
                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini" style="margin-left: -170px;">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{DailyAssessment.TerritorialEvaluationDate+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.TerritorialEvaluationDate" type="date" size="mini"
                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>
                <el-col :span="11":offset="2">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input type="text" v-model="Form.BusinessManagementEvaluator" autocomplete="off" size="mini">
                                <template slot="prepend">
                                    {{DailyAssessment.BusinessManagementEvaluator+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>

                
                <el-col :span="11">
                    <el-form-item>
                        <div class="elst-select-mini" style="margin-left: -170px;">
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{DailyAssessment.BusinessManagementEvaluationData+mark.m}}
                                </template>
                                <el-date-picker slot="suffix" v-model="Form.BusinessManagementEvaluationData" type="date" size="mini"
                                    format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择时间">
                                </el-date-picker>
                            </el-input>
                        </div>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-form-item :label="DailyAssessment.BusinessManagementEvaluationConclusion+mark.m" prop="BusinessManagementEvaluationConclusion">
                    <el-input type="textarea" v-model="Form.BusinessManagementEvaluationConclusion" autocomplete="off"></el-input>
                </el-form-item>
            </el-row>
            <el-row>
                <el-col span="4" style=" ">
                    <el-form-item label="考核内容及评分： ">
                    </el-form-item>
                </el-col>
                <el-col span="24" >
                    <el-table stripe :data="Form.CheckProjectList"
                              border
                              style="width:100%">
                        <el-table-column prop="CheckProject"
                                         :label="DailyAssessmentType.CheckProject">
                        </el-table-column>
                        <el-table-column :label="DailyAssessmentType.checkResults">
                            <template slot-scope="scope">
                                <el-select @visible-change="visibleChange" @change="handleSelect" v-model="scope.row.score" placeholder="请选择">
                                    <el-option v-for="item in score" :key="item.key" :label="item.value" :value="item.key"></el-option>
                                </el-select>
                            </template>
                        </el-table-column>

                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                <el-button @click.native.prevent="deleteRow(scope.$index, Form.CheckProjectList)"
                                           type="text"
                                           size="small">
                                    移除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <el-row type="flex" justify="end" style="margin-top:10px">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnSave}}</el-button>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnCommit}}</el-button>
                    <el-button type="primary" @click="onBack">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog title="承包商列表" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                   top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>
    <script type="text/javascript">

        var app = new Vue({
            el: '#app',
            data: {
                id: '',
                score: [],
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    DailyAssessmentTypeName: '',//日常评估考核类别名称
                    ContractorName: '', //"承包商名称"
                    ProjectName: '', //"项目名称"
                    Fraction:0,// 分数
                    TerritorialAppraiser: '',//属地评价人
                    TerritorialEvaluationConclusion: '',//属地评价结论
                    TerritorialEvaluationDate: '',//属地评价日期
                    BusinessManagementEvaluator: '',//业务管理评价人
                    BusinessManagementEvaluationConclusion: '',//业务管理评价结论
                    BusinessManagementEvaluationData: '',//业务管理评价日期
                    IsContractorDirectory: '',//是否列入合格承包商名录
                    SummaryEvaluator: '',//总结评价人
                    SummaryEvaluationDate: '',//总结评价日期
                    CheckProjectList: [],
                },  
                reviewPeople: [],
                DailyAssessmentTypeName: [],
                IsContractorDirectory: [],
                IsConsumables: [],
                ListItem: ListItem,
                //表单验证
                rules: {
                    TerritorialAppraiser: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(2, 5), message: verification.StringLengthAtoB.m.format(2, 5), trigger: 'blur' }
                    ],
                    ContractorName: [
                        verification.NotNull,
                        { pattern: verification.StringLengthAtoB.t.format(5, 50), message: verification.StringLengthAtoB.m.format(5, 10), trigger: 'blur' }
                    ],
                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleChange: function (value) {
                    console.log(value);
                },
                handleSelect: function (ev) {
                    console.log(ev);
                },
                deleteRow: function (index, rows) {
                    rows.splice(index, 1);
                },
                onBack: function () {
                    parent.app.ListItem.dialogVisible = false;
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/DailyAssessment/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                getData: function () {
                    getData(this, '/api/DailyAssessment/get?id=' + this.id);
                },
                random :function (lower, upper) {
                return Math.floor(Math.random() * (upper - lower)) + lower;
                 },
                aa: function () {
                    var mythis = this;
                    mythis.Form.CheckProjectList = [];
                    for (var i = 0; i < 5; i++) {
                        var Number = random(0, 4);
                        var CheckProject = {};
                        CheckProject.CheckProject = getDicValue("107", Number);
                        CheckProject.score = '';
                        mythis.Form.CheckProjectList.push(CheckProject);
                    } 
                },
                ContractorInput: function (val, id) { DialogShow(this, val, "ContractorDirectoryList.html", id); },
            },
            mounted: function () {

                var list = getDicDataArray(['50', '56', '60', '61']);
                this.IsContractorDirectory = getDicDatafromArray('50', list);
                this.DailyAssessmentTypeName = getDicDatafromArray('56',list);
                this.score = getDicDatafromArray('60',list);
                this.reviewPeople = getDicDatafromArray('61',list);
                this.id = getUrlParam("id");
                this.getData();
            }
        });
    </script>
</body>

</html>